/********************************************************************************
 * Copyright (c)2016-2020, ShenZhen WanJiaAn Technology CO.,LTD.
 * All Rights Reserved.
 *
 * File Name     : UpgradeRecovery.h
 * Author        : JiangWendao
 * Date          : 2020-04-10
 *
 * Record        :
 * 1.Date        : 2020-04-10
 *   Author      : JiangWendao
 *   Modification: Created file
 ********************************************************************************/

#ifndef __UPGRADERECOVERY_H__
#define __UPGRADERECOVERY_H__


#ifdef __cplusplus
#if __cplusplus
extern "C"{
#endif
#endif /* __cplusplus */

#define UPGRADE_RECOVERY_FILE "/ramfs/upgrade.bin"
#define UPGRADE_RECOVERY_RETRY_NUM  (5)

typedef enum {
    UPGRADE_STATUS_INIT 			= 0,
    UPGRADE_STATUS_DOWNLOAD_FAIL	= 1,
    UPGRADE_STATUS_EXECUT_FAIL	    = 2,
    UPGRADE_STATUS_SHUTDOWN_FAIL	= 3, //升级过程断电
}UPGRADE_STATUS_TYPE_E;

int UpgradeRecoverySetInfo(char *url, char *md5, int pktSize);
int UpgradeRecoveryGetInfo(char *pUrl, char *pMd5, int *pPktSize);
int UpgradeRecoverySetState(int upgradeState);
int UpgradeRecoveryGetState(int *pUpgradeState);
int UpgradeRecoverySetRetryCnt(int retryCnt);
int UpgradeRecoveryGetRetryCnt(int *pRetryCnt);
int UpgradeRecoveryProcess(UPGRADE_STATUS_TYPE_E enUpgradeStatus);
int UpgradeRecoveryStart(UPGRADE_STATUS_TYPE_E enUpgradeStatus);
int UpgradeRecoverySelfCheck(void);

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */


#endif /* __UPGRADERECOVERY_H__ */


